home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / icons / animator.zip / STATBAR.C < prev    next >
C/C++ Source or Header  |  1993-02-18  |  4KB  |  105 lines

  1. #include "animator.h"
  2.  
  3. static char  sztext[MAX_FILE_SIZE];
  4. static char  szBarText[180];
  5.  
  6.  
  7. //////////////////////////////////////////////////////////////////////////
  8. // StatusBarProc - just draws what it is supposed to draw in the 
  9. // form of a status bar.  The status bar displays the MDI child 
  10. // window title and tells whether it is animating or not.
  11. //////////////////////////////////////////////////////////////////////////
  12.  
  13. LRESULT _export CALLBACK StatusBarProc (WNDPROC_PARAMS)
  14. {
  15.     PAINTSTRUCT    ps;
  16.     HDC            hDC;
  17.     HPEN           hpnOld;
  18.     HWND           hwndMDI ;
  19.     RECT           rc;    
  20.  
  21.     /* No reason to use the Message Crackers here */
  22.  
  23.     if (uMsg == WM_PAINT)
  24.     {
  25.         hDC = BeginPaint (hWnd, &ps);
  26.  
  27.     // Set rect coordinates...
  28.         GetClientRect (hWnd, &rc);
  29.     
  30.     // Draw Black line above bar...and save previously-selected pen
  31.         hpnOld = SelectPen (hDC, _hpnBlack);
  32.         MoveTo (hDC, rc.left, rc.top);
  33.         LineTo (hDC, rc.right, rc.top);
  34.  
  35.     // Draw White shadows...
  36.         SelectPen (hDC, _hpnWhite);
  37.         MoveTo (hDC, rc.left, rc.top+1);
  38.         LineTo (hDC, rc.right, rc.top+1);
  39.  
  40.     // Draw gray shadows...then re-select old pen back into context
  41.         SelectPen (hDC, _hpnGray);
  42.         MoveTo (hDC, 0, rc.bottom-1);
  43.         LineTo (hDC, rc.right, rc.bottom-1);
  44.         SelectPen (hDC, hpnOld);
  45.  
  46.     // Do text...
  47.         SetBkColor (hDC, GetSysColor(COLOR_BTNFACE));
  48.         SetTextColor (hDC, GetSysColor(COLOR_BTNTEXT));
  49.         SelectFont (hDC, GetStockFont(ANSI_VAR_FONT));
  50.  
  51.         if (hwndMDI = MDI_GetActive(_hwndClient))
  52.         {
  53.             short sChild = WINDOWNUM(hwndMDI);
  54.  
  55.             GetWindowText (hwndMDI, (LPSTR)sztext, sizeof(sztext));         
  56.  
  57.             if (ISANIMATING(sChild) && !EXELOADED(sChild))
  58.             {
  59.                 wsprintf ((LPSTR)szBarText, (LPSTR)"%s %s", 
  60.                           (LPSTR)sztext, (LPSTR)"will animate when target is loaded");
  61.             }
  62.             else if (ISANIMATING(sChild) && EXELOADED(sChild))
  63.             {
  64.                 wsprintf ((LPSTR)szBarText, (LPSTR)"%s is %s", 
  65.                           (LPSTR)sztext, (LPSTR)"animating");
  66.             }
  67.             else if (TIMEINT(sChild) && SZEXELINK(sChild)[0] && 
  68.                 (!ISANIMATING(sChild)))
  69.             {
  70.                 wsprintf ((LPSTR)szBarText, (LPSTR)"%s is %s", 
  71.                           (LPSTR)sztext, 
  72.                           (LPSTR)"is currently ready but stopped");
  73.             }
  74.             else if (TIMEINT(sChild) && (!SZEXELINK(sChild)[0]))
  75.             {
  76.                 wsprintf ((LPSTR)szBarText, 
  77.                           (LPSTR)"%s needs to link to an application",
  78.                           (LPSTR)sztext);
  79.             }
  80.             else if ((!TIMEINT(sChild)) && SZEXELINK(sChild)[0])
  81.             {
  82.                 wsprintf ((LPSTR)szBarText, (LPSTR)"%s needs a timer setting",
  83.                     (LPSTR)sztext);
  84.             }
  85.         }
  86.         else
  87.         {
  88.             wsprintf ((LPSTR)szBarText,(LPSTR)"No Animations currently open");
  89.         }
  90.  
  91.         rc.left += 10;  // just add a cheap indent...
  92.  
  93.         DrawText (hDC, szBarText, lstrlen (szBarText), &rc, 
  94.             DT_NOCLIP|DT_SINGLELINE|DT_VCENTER|DT_LEFT);
  95.  
  96.         EndPaint (hWnd, &ps);
  97.         return 0L;
  98.     }
  99.  
  100.     return DefWindowProc (hWnd, uMsg, wParam, lParam);
  101. }
  102.         
  103.         
  104.         
  105.